package com.hqyj.controller;


import com.hqyj.pojo.TbChargeItem;
import com.hqyj.service.TbChargeItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * <p>
 * 收费项目表 前端控制器
 * </p>
 *
 * @author gp
 * @since 2021-09-25
 */
@RestController
@RequestMapping("/tb-charge-item")
public class TbChargeItemController {
    @Autowired
    TbChargeItemService tbChargeItemService;
    /**
    * @Author:YaoHaoHong
    * @Description:
     * http://localhost:8080/tb-charge-item/list
    * @Date:2021/10/8 11:36
    */
    @GetMapping("/list")
    HashMap<String ,Object> list(TbChargeItem tbChargeItem){
        return tbChargeItemService.list(tbChargeItem);
    }

    /**
    * @Author:YaoHaoHong
    * @Description:
     * @新增
    * @Date:2021/10/9 18:54
    */
    @PostMapping(value = "/add",consumes = "application/json")
    HashMap<String ,Object> insert(@RequestBody TbChargeItem tbChargeItem){
        return tbChargeItemService.insert(tbChargeItem);
    }

    /**
    * @Author:YaoHaoHong
    * @Description:
     * 修改
    * @Date:2021/10/9 19:03
    */
    @PutMapping(value = "/update",consumes = "application/json")
    HashMap<String ,Object> update(@RequestBody TbChargeItem tbChargeItem){
        return tbChargeItemService.update(tbChargeItem);
    }

    /**
    * @Author:YaoHaoHong
    * @Description:
     * 删除
    * @Date:2021/10/9 19:05
    */
    @DeleteMapping(value = "/del/{id}")
    HashMap<String ,Object> delete(@PathVariable Integer id){
        return tbChargeItemService.delete(id);
    }
}

